-
Notifications
You must be signed in to change notification settings - Fork 5.9k
settings_ui: Fix memory leak #41036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
settings_ui: Fix memory leak #41036
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The leak mainly showed up in the appearance page because it had a lot of dropdown menus. The problem occurred because the drop down menus were creating a new entity on each frame instead of using the window.use_state... api. Co-authored-by: Mikayla Maki <[email protected]>
Co-authored-by: Mikayla Maki <[email protected]>
probably-neb
added a commit
that referenced
this pull request
Nov 4, 2025
Closes #41533 Both of the issues in the release notes that are fixed in this PR, were caused by incorrect usage of the `window.use_state` API. The first issue was caused by calling `window.use_state` in a render helper, resulting in the element ID used to share state being the same across different pages, resulting in the state being re-used when it should have been re-created. The fix for this was to move the `window.state` (and rendering logic) into a `impl RenderOnce` component, so that the IDs are resolved during the render, avoiding the state conflicts. The second issue is caused by using a `move` closure in the `window.use_state` call, resulting in stale closure values when the window state is re-used. Release Notes: - settings_ui: Fixed an issue where some dropdown menus would show options from a different dropdown when clicked - settings_ui: Fixed an issue where attempting to change a setting in a dropdown back to it's original value after changing it would do nothing
ConradIrwin
pushed a commit
that referenced
this pull request
Nov 4, 2025
Closes #41533 Both of the issues in the release notes that are fixed in this PR, were caused by incorrect usage of the `window.use_state` API. The first issue was caused by calling `window.use_state` in a render helper, resulting in the element ID used to share state being the same across different pages, resulting in the state being re-used when it should have been re-created. The fix for this was to move the `window.state` (and rendering logic) into a `impl RenderOnce` component, so that the IDs are resolved during the render, avoiding the state conflicts. The second issue is caused by using a `move` closure in the `window.use_state` call, resulting in stale closure values when the window state is re-used. Release Notes: - settings_ui: Fixed an issue where some dropdown menus would show options from a different dropdown when clicked - settings_ui: Fixed an issue where attempting to change a setting in a dropdown back to it's original value after changing it would do nothing
probably-neb
added a commit
that referenced
this pull request
Nov 4, 2025
Cherry-pick of #41920 ---- Closes #41533 Both of the issues in the release notes that are fixed in this PR, were caused by incorrect usage of the `window.use_state` API. The first issue was caused by calling `window.use_state` in a render helper, resulting in the element ID used to share state being the same across different pages, resulting in the state being re-used when it should have been re-created. The fix for this was to move the `window.state` (and rendering logic) into a `impl RenderOnce` component, so that the IDs are resolved during the render, avoiding the state conflicts. The second issue is caused by using a `move` closure in the `window.use_state` call, resulting in stale closure values when the window state is re-used. Release Notes: - settings_ui: Fixed an issue where some dropdown menus would show options from a different dropdown when clicked - settings_ui: Fixed an issue where attempting to change a setting in a dropdown back to it's original value after changing it would do nothing Co-authored-by: Ben Kunkle <[email protected]>
tomatitito
pushed a commit
to tomatitito/zed
that referenced
this pull request
Nov 7, 2025
…#41920) Closes zed-industries#41533 Both of the issues in the release notes that are fixed in this PR, were caused by incorrect usage of the `window.use_state` API. The first issue was caused by calling `window.use_state` in a render helper, resulting in the element ID used to share state being the same across different pages, resulting in the state being re-used when it should have been re-created. The fix for this was to move the `window.state` (and rendering logic) into a `impl RenderOnce` component, so that the IDs are resolved during the render, avoiding the state conflicts. The second issue is caused by using a `move` closure in the `window.use_state` call, resulting in stale closure values when the window state is re-used. Release Notes: - settings_ui: Fixed an issue where some dropdown menus would show options from a different dropdown when clicked - settings_ui: Fixed an issue where attempting to change a setting in a dropdown back to it's original value after changing it would do nothing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #40351
The leak mainly showed up in the appearance page because it had a lot of dropdown menus. The problem occurred because the drop-down menus were creating a new entity on each frame instead of using the
window.use_state...API.Release Notes: